<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org"
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <meta charset="UTF-8" />
    <title>供应商 - 商品详细表</title>

    <link rel="stylesheet" href="/static/ace/components/_mod/jquery-ui/jquery-ui.css"/>
    <link rel="stylesheet"
          href="/static/ace/components/bootstrap-datepicker/dist/css/bootstrap-datepicker3.css"/>
    <link rel="stylesheet" href="/static/ace/components/_mod/jqgrid/ui.jqgrid.css"/>
    <script src="/static/statistics/js/bootstrap-datetimepicker.min.js"></script>
    <script src="/static/statistics/js/bootstrap-datetimepicker.zh-CN.js"></script>
    <script src="/static/statistics/js/vue.js"></script>

    <style type="text/css">
        .customBtn {
            line-height: 20px;
            margin-bottom: 3px;
        }

        .btnLine {
            margin-left: 1px;
            margin-top: 8px;
            margin-bottom: 2px;
        }

        @-webkit-keyframes bouncedelay {
            0%, 80%, 100% {
                -webkit-transform: scale(0.0)
            }
            40% {
                -webkit-transform: scale(1.0)
            }
        }

        @keyframes bouncedelay {
            0%, 80%, 100% {
                transform: scale(0.0);
                -webkit-transform: scale(0.0);
            }
            40% {
                transform: scale(1.0);
                -webkit-transform: scale(1.0);
            }
        }

        .autocomplete-suggestions {
            border: 1px solid #999;
            background: #FFF;
            overflow: auto;
        }

        .autocomplete-suggestion {
            padding: 2px 5px;
            white-space: nowrap;
            overflow: hidden;
        }

        .autocomplete-selected {
            background: #F0F0F0;
        }

        .autocomplete-suggestions strong {
            font-weight: normal;
            color: #3399FF;
        }

        @-moz-document url-prefix() {
            fieldset {
                display: table-cell;
            }
        }

        .ui-jqgrid-sortable {
            text-align: center;
        }
    </style>
</head>
<body>

    <div class="row" id="appAlert">
        <div class="row btnLine">
            <div class="button-len col-sm-12">
                <div style="width: 100%; margin-bottom: 10px;">
                    <button class="btn btn-white btn-sm btn-purple customBtn" id="addProduct">
                        <i class="ace-icon fa fa-plus-circle purple"></i> 新增
                    </button>
<!--                    <%&#45;&#45;<button class="btn btn-white btn-info btn-sm customBtn" id="editShop">&#45;&#45;%>-->
<!--                    <%&#45;&#45;<i class="ace-icon fa fa-pencil blue"></i> 修改&#45;&#45;%>-->
<!--                    <%&#45;&#45;</button>&#45;&#45;%>-->
                    <button class="btn btn-white btn-info btn-sm customBtn" id="deleteSupplier">
                        <i class="ace-icon fa fa-key red"></i> 删除
                    </button>
<!--                    <%&#45;&#45;<button class="btn btn-white btn-info btn-sm customBtn" id="">&#45;&#45;%>-->
<!--                    <%&#45;&#45;<i class="ace-icon fa fa-key red"></i> 复制&#45;&#45;%>-->
<!--                    <%&#45;&#45;</button>&#45;&#45;%>-->
<!--                    <%&#45;&#45;<button class="btn btn-white btn-info btn-sm customBtn" id="">&#45;&#45;%>-->
<!--                    <%&#45;&#45;<i class="ace-icon fa fa-key red"></i> 打印&#45;&#45;%>-->
<!--                    <%&#45;&#45;</button>&#45;&#45;%>-->
<!--                    <%&#45;&#45;<button class="btn btn-white btn-info btn-sm customBtn" id="">&#45;&#45;%>-->
<!--                    <%&#45;&#45;<i class="ace-icon fa fa-key red"></i> 导出&#45;&#45;%>-->
<!--                    <%&#45;&#45;</button>&#45;&#45;%>-->
<!--                    <%&#45;&#45;<button class="btn btn-white btn-info btn-sm customBtn" id="">&#45;&#45;%>-->
<!--                    <%&#45;&#45;<i class="ace-icon fa fa-key red"></i> 设置&#45;&#45;%>-->
<!--                    <%&#45;&#45;</button>&#45;&#45;%>-->
<!--                    <%&#45;&#45;<button class="btn btn-white btn-info btn-sm customBtn" id="">&#45;&#45;%>-->
<!--                    <%&#45;&#45;<i class="ace-icon fa fa-key red"></i> 退出&#45;&#45;%>-->
<!--                    <%&#45;&#45;</button>&#45;&#45;%>-->
<!--                    <%&#45;&#45;</div>&#45;&#45;%>-->
<!--                <%&#45;&#45;<div style="width: 100%; margin-bottom: 10px;">&#45;&#45;%>-->
                <input class="input-sm" type="text" id="productType" name="productType" style="margin-left: 0px;"
                       placeholder="类别" />
                <input class="input-sm" type="text" id="productCode1" name="productCode1" style="margin-left: 0px;"
                       placeholder="货号" />
<!--                <%&#45;&#45;<input class="input-sm" type="text"style="margin-left: 0px;"&#45;&#45;%>-->
<!--                <%&#45;&#45;placeholder="品牌">&#45;&#45;%>-->
                <input class="input-sm" type="text" id="helpCode" name="helpCode" style="margin-left: 0px;"
                       placeholder="助记码" />
                <input class="input-sm" type="text" id="recordId" name="recordId" style="margin-left: 0px;"
                       placeholder="自编码" />
                <button class="btn btn-sm btn-white btn-info search-len customBtn"
                        onclick="searchShop()">
                    <i class="ace-icon fa fa-search orange"></i>搜索
                </button>
                <button type="button" class="btn btn-sm btn-white btn-info search-len customBtn" onclick="javascript:window.history.go(-1);window.close();">返回</button>
            </div>
<!--                <%&#45;&#45;<label for="">零售价：</label>&#45;&#45;%>-->
<!--                <%&#45;&#45;<select class="input-sm" id="isAuthInput">&#45;&#45;%>-->
<!--                <%&#45;&#45;<option value="=">等于</option>&#45;&#45;%>-->
<!--                <%&#45;&#45;<option value=">">大于</option>&#45;&#45;%>-->
<!--                <%&#45;&#45;<option value=">=">大于等于</option>&#45;&#45;%>-->
<!--                <%&#45;&#45;<option value="<">小于</option>&#45;&#45;%>-->
<!--                <%&#45;&#45;<option value="<=">小于等于</option>&#45;&#45;%>-->
<!--                <%&#45;&#45;</select>&#45;&#45;%>-->
<!--                <%&#45;&#45;<input class="input-sm" type="text" id="" style="margin-left: 0px;"&#45;&#45;%>-->
<!--                <%&#45;&#45;placeholder="零售价">&#45;&#45;%>-->
    
            </div>
        </div>
        <!-- 内容数据开始 -->
        <div class="col-xs-12">
            <table id="grid-table"></table>
    
            <div id="grid-pager"></div>
    
        </div>
    
        <!-- 内容数据结束 -->
    
    
        <!-- 商品模态框（Modal） -->
        <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
            <div class="modal-dialog" style="width: 840px;">
                <div class="modal-content">
                    <div class="modal-header" style="font-size: 20px; margin-bottom: -15px;">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                            &times;
                        </button>
                        <h4 class="modal-title" id="myModalLabel">
                            供应商 - <span id="alertTitle">商品新增</span>
                            <small id="smallTitle" class="hide" style="color: red; float: right; margin-top: 10px;"></small>
                        </h4>
                    </div>
                    <div class="modal-body">
                        <div class="row" style="height: 100px;">
                            <table class="table">
                                <tbody>
                                <tr>
                                    <th>
                                        <div class="row btnLine">
                                            <div class="button-len col-sm-12">
                                                <label for="" style="margin-left: 8px;">商品类型：</label>
                                                <select class="input-sm" id="isExpInput">
                                                    <option value="0">商品类型</option>
                                                    <option :value="obj.typeId" v-for="(obj, index) in yanType1">
                                                        {{ obj.typeName }}
                                                    </option>
    
                                                </select>
                                                <select class="input-sm" id="isAuthInput">
                                                    <option value="-1">商品大类</option>
                                                    <option :value="obj.typeId" v-for="(obj, index) in yanType2">
                                                        {{ obj.typeName }}
                                                    </option>
                                                </select>
    
                                                <select class="input-sm" id="isAuthInput1">
                                                    <option value="-1">商品中类</option>
                                                    <option :value="obj.typeId" v-for="(obj, index) in yanType3">
                                                        {{ obj.typeName }}
                                                    </option>
                                                </select>
    
                                                <select class="input-sm" id="isAuthInput2">
                                                    <option value="-1">商品小类</option>
                                                    <option :value="obj.typeId" v-for="(obj, index) in yanType4">
                                                        {{ obj.typeName }}
                                                    </option>
                                                </select>
                                            </div>
                                        </div>
                                    </th>
                                </tr>
                                <tr>
                                    <th>
                                        <input class="input-sm" type="text" id="productCode" style="margin-left: 20px;"
                                               placeholder="商品条码" />
                                        <input class="input-sm" type="text" id="productName" style="margin-left: 5px;"
                                               placeholder="商品名称" />
                                        <button class="btn btn-sm btn-white btn-info search-len customBtn"
                                                onclick="searchShopProduct()">
                                            <i class="ace-icon fa fa-search orange"></i>搜索
                                        </button>
                                    </th>
                                </tr>
                                </tbody>
                            </table>
                        </div>
                        <!-- 内容数据开始 -->
                        <div class="button-len col-sm-12">
                            <table id="grid-prod-table"></table>
                            <div id="grid-prod-pager"></div>
                        </div>
                        <!-- 内容数据结束 -->
                        <div style="text-align: right;">
                            <button class="btn btn-white btn-info btn-sm customBtn btn-xs" type="button" id="appProd" onclick="addSupplierShop()" style="margin-top: 10px; margin-right: 11px;">添加</button>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default btn-xs" data-dismiss="modal" v-on:click="close">关闭</button>
<!--                        <%&#45;&#45;<button type="button" class="btn btn-primary btn-xs" v-on:click="saveSupplier">提交更改</button>&#45;&#45;%>-->
                    </div>
                </div><!-- /.modal-content -->
            </div><!-- /.modal -->
        </div>
    
        <!-- 模态框（Modal） -->
<!--        <%&#45;&#45;<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">&#45;&#45;%>-->
<!--        <%&#45;&#45;<div class="modal-dialog" style="width: 800px;">&#45;&#45;%>-->
<!--            <%&#45;&#45;<div class="modal-content">&#45;&#45;%>-->
<!--                <%&#45;&#45;<div class="modal-header" style="font-size: 20px; margin-bottom: -15px;">&#45;&#45;%>-->
<!--                    <%&#45;&#45;<h4 class="modal-title" id="myModalLabel">&#45;&#45;%>-->
<!--                        <%&#45;&#45;供应商 - <span id="alertTitle">商品新增</span>&#45;&#45;%>-->
<!--                        <%&#45;&#45;<small id="smallTitle" class="hide" style="color: red; float: right; margin-top: 10px;"></small>&#45;&#45;%>-->
<!--    -->
<!--                        <%&#45;&#45;</h4>&#45;&#45;%>-->
<!--                    <%&#45;&#45;</div>&#45;&#45;%>-->
<!--                <%&#45;&#45;<div class="modal-body">&#45;&#45;%>-->
<!--                    <%&#45;&#45;<div class="row">&#45;&#45;%>-->
<!--                        <%&#45;&#45;<table class="table">&#45;&#45;%>-->
<!--                            <%&#45;&#45;<tbody>&#45;&#45;%>-->
<!--                            <%&#45;&#45;<tr>&#45;&#45;%>-->
<!--                                <%&#45;&#45;<th>&#45;&#45;%>-->
<!--                                    <%&#45;&#45;<div class="row btnLine">&#45;&#45;%>-->
<!--                                        <%&#45;&#45;<div class="button-len col-sm-12">&#45;&#45;%>-->
<!--                                            <%&#45;&#45;<label for="" style="margin-left: 8px;">商品类型：</label>&#45;&#45;%>-->
<!--                                            <%&#45;&#45;<select class="input-sm" id="isExpInput">&#45;&#45;%>-->
<!--                                                <%&#45;&#45;<option value="0">商品类型</option>&#45;&#45;%>-->
<!--                                                <%&#45;&#45;<option :value="obj.typeId" v-for="(obj, index) in yanType1">&#45;&#45;%>-->
<!--                                                    <%&#45;&#45;{{ obj.typeName }}&#45;&#45;%>-->
<!--                                                    <%&#45;&#45;</option>&#45;&#45;%>-->
<!--    -->
<!--                                                <%&#45;&#45;</select>&#45;&#45;%>-->
<!--                                            <%&#45;&#45;<select class="input-sm" id="isAuthInput">&#45;&#45;%>-->
<!--                                                <%&#45;&#45;<option value="-1">商品大类</option>&#45;&#45;%>-->
<!--                                                <%&#45;&#45;<option :value="obj.typeId" v-for="(obj, index) in yanType2">&#45;&#45;%>-->
<!--                                                    <%&#45;&#45;{{ obj.typeName }}&#45;&#45;%>-->
<!--                                                    <%&#45;&#45;</option>&#45;&#45;%>-->
<!--                                                <%&#45;&#45;</select>&#45;&#45;%>-->
<!--    -->
<!--                                            <%&#45;&#45;<select class="input-sm" id="isAuthInput1">&#45;&#45;%>-->
<!--                                                <%&#45;&#45;<option value="-1">商品中类</option>&#45;&#45;%>-->
<!--                                                <%&#45;&#45;<option :value="obj.typeId" v-for="(obj, index) in yanType3">&#45;&#45;%>-->
<!--                                                    <%&#45;&#45;{{ obj.typeName }}&#45;&#45;%>-->
<!--                                                    <%&#45;&#45;</option>&#45;&#45;%>-->
<!--                                                <%&#45;&#45;</select>&#45;&#45;%>-->
<!--    -->
<!--                                            <%&#45;&#45;<select class="input-sm" id="isAuthInput2">&#45;&#45;%>-->
<!--                                                <%&#45;&#45;<option value="-1">商品小类</option>&#45;&#45;%>-->
<!--                                                <%&#45;&#45;<option :value="obj.typeId" v-for="(obj, index) in yanType4">&#45;&#45;%>-->
<!--                                                    <%&#45;&#45;{{ obj.typeName }}&#45;&#45;%>-->
<!--                                                    <%&#45;&#45;</option>&#45;&#45;%>-->
<!--                                                <%&#45;&#45;</select>&#45;&#45;%>-->
<!--                                            <%&#45;&#45;</div>&#45;&#45;%>-->
<!--                                        <%&#45;&#45;</div>&#45;&#45;%>-->
<!--                                    <%&#45;&#45;</th>&#45;&#45;%>-->
<!--                                <%&#45;&#45;</tr>&#45;&#45;%>-->
<!--                            <%&#45;&#45;<tr>&#45;&#45;%>-->
<!--                                <%&#45;&#45;<th>&#45;&#45;%>-->
<!--                                    <%&#45;&#45;<input class="input-sm" type="text" id="productCode" style="margin-left: 20px;"&#45;&#45;%>-->
<!--                                    <%&#45;&#45;placeholder="商品条码">&#45;&#45;%>-->
<!--                                    <%&#45;&#45;<input class="input-sm" type="text" id="productName" style="margin-left: 5px;"&#45;&#45;%>-->
<!--                                    <%&#45;&#45;placeholder="商品名称">&#45;&#45;%>-->
<!--                                    <%&#45;&#45;<button class="btn btn-sm btn-white btn-info search-len customBtn"&#45;&#45;%>-->
<!--                                        <%&#45;&#45;v-on:click="queryShop">&#45;&#45;%>-->
<!--                                        <%&#45;&#45;<i class="ace-icon fa fa-search orange"></i>搜索&#45;&#45;%>-->
<!--                                        <%&#45;&#45;</button>&#45;&#45;%>-->
<!--                                    <%&#45;&#45;</th>&#45;&#45;%>-->
<!--                                <%&#45;&#45;</tr>&#45;&#45;%>-->
<!--                            <%&#45;&#45;<tr>&#45;&#45;%>-->
<!--                                <%&#45;&#45;<th>&#45;&#45;%>-->
<!--                                    <%&#45;&#45;&lt;!&ndash; 商品数据开始 &ndash;&gt;&#45;&#45;%>-->
<!--                                    <%&#45;&#45;<table class="table table-striped table-condensed table-bordered" style="background-color: #eee; width: 100%; font-size: 10px;">&#45;&#45;%>-->
<!--                                        <%&#45;&#45;<thead>&#45;&#45;%>-->
<!--                                        <%&#45;&#45;<tr>&#45;&#45;%>-->
<!--                                            <%&#45;&#45;<th>ID</th>&#45;&#45;%>-->
<!--                                            <%&#45;&#45;<th>商品名称</th>&#45;&#45;%>-->
<!--                                            <%&#45;&#45;<th>类型</th>&#45;&#45;%>-->
<!--                                            <%&#45;&#45;<th>条码</th>&#45;&#45;%>-->
<!--                                            <%&#45;&#45;<th>供货价格</th>&#45;&#45;%>-->
<!--                                            <%&#45;&#45;<th>商品价格</th>&#45;&#45;%>-->
<!--                                            <%&#45;&#45;<th>状态</th>&#45;&#45;%>-->
<!--                                            <%&#45;&#45;<th>单位</th>&#45;&#45;%>-->
<!--                                            <%&#45;&#45;<th>规格</th>&#45;&#45;%>-->
<!--                                            <%&#45;&#45;<th>操作</th>&#45;&#45;%>-->
<!--                                            <%&#45;&#45;</tr>&#45;&#45;%>-->
<!--                                        <%&#45;&#45;</thead>&#45;&#45;%>-->
<!--                                        <%&#45;&#45;<tbody>&#45;&#45;%>-->
<!--                                        <%&#45;&#45;<tr v-for="(obj, index) in objects">&#45;&#45;%>-->
<!--                                            <%&#45;&#45;<th>{{ obj.id }}</th>&#45;&#45;%>-->
<!--                                            <%&#45;&#45;<td>{{ obj.productName }}</td>&#45;&#45;%>-->
<!--                                            <%&#45;&#45;<th>{{ obj.prodTypeName }}</th>&#45;&#45;%>-->
<!--                                            <%&#45;&#45;<th>&#45;&#45;%>-->
<!--                                                <%&#45;&#45;{{ obj.productCode }}&#45;&#45;%>-->
<!--                                                <%&#45;&#45;<input type="text" name="productCode" :value="obj.productCode" style="display:none"/>&#45;&#45;%>-->
<!--                                                <%&#45;&#45;<input type="text" name="cstPrice" :value="obj.cstPrice" style="display:none"/>&#45;&#45;%>-->
<!--                                                <%&#45;&#45;</th>&#45;&#45;%>-->
<!--                                            <%&#45;&#45;<th>&#45;&#45;%>-->
<!--                                                <%&#45;&#45;<input class="input-sm" type="text" style="margin-left: 20px;"&#45;&#45;%>-->
<!--                                                <%&#45;&#45;placeholder="">&#45;&#45;%>-->
<!--                                                <%&#45;&#45;<input type="text" name="supplierPrice" :value="obj.supplierPrice" style="border:0;outline:0; width: 30px; background-color: #F5F8FC;margin: 0px auto;"/>&#45;&#45;%>-->
<!--                                                <%&#45;&#45;</th>&#45;&#45;%>-->
<!--                                            <%&#45;&#45;<th>{{ obj.cstPrice }}</th>&#45;&#45;%>-->
<!--                                            <%&#45;&#45;<th>{{ obj.state }}</th>&#45;&#45;%>-->
<!--                                            <%&#45;&#45;<th>{{ obj.unit }}</th>&#45;&#45;%>-->
<!--                                            <%&#45;&#45;<th>{{ obj.spec }}</th>&#45;&#45;%>-->
<!--                                            <%&#45;&#45;<th>&#45;&#45;%>-->
<!--                                                <%&#45;&#45;<button onclick="addSupplierShop()">添加</button>&#45;&#45;%>-->
<!--                                                <%&#45;&#45;</th>&#45;&#45;%>-->
<!--                                            <%&#45;&#45;</tr>&#45;&#45;%>-->
<!--                                        <%&#45;&#45;</tbody>&#45;&#45;%>-->
<!--                                        <%&#45;&#45;</table>&#45;&#45;%>-->
<!--                                    <%&#45;&#45;&lt;!&ndash; 商品数据结束 &ndash;&gt;&#45;&#45;%>-->
<!--                                    <%&#45;&#45;</th>&#45;&#45;%>-->
<!--                                <%&#45;&#45;</tr>&#45;&#45;%>-->
<!--                            <%&#45;&#45;</tbody>&#45;&#45;%>-->
<!--                            <%&#45;&#45;</table>&#45;&#45;%>-->
<!--                        <%&#45;&#45;</div>&#45;&#45;%>-->
<!--                    <%&#45;&#45;&lt;!&ndash; 内容数据开始 &ndash;&gt;&#45;&#45;%>-->
<!--                    <%&#45;&#45;<div class="col-xs-12">&#45;&#45;%>-->
<!--                        <%&#45;&#45;<table id="grid-product-table"></table>&#45;&#45;%>-->
<!--    -->
<!--                        <%&#45;&#45;<div id="grid-product-pager"></div>&#45;&#45;%>-->
<!--    -->
<!--                        <%&#45;&#45;</div>&#45;&#45;%>-->
<!--    -->
<!--                    <%&#45;&#45;&lt;!&ndash; 内容数据结束 &ndash;&gt;&#45;&#45;%>-->
<!--                    <%&#45;&#45;</div>&#45;&#45;%>-->
<!--                <%&#45;&#45;<div class="modal-footer">&#45;&#45;%>-->
<!--                    <%&#45;&#45;<button type="button" class="btn btn-default btn-xs" data-dismiss="modal" v-on:click="close">关闭</button>&#45;&#45;%>-->
<!--                    <%&#45;&#45;&lt;%&ndash;<button type="button" class="btn btn-primary btn-xs" v-on:click="saveSupplier">提交更改</button>&ndash;%&gt;&#45;&#45;%>-->
<!--                    <%&#45;&#45;</div>&#45;&#45;%>-->
<!--                <%&#45;&#45;</div>&lt;!&ndash; /.modal-content &ndash;&gt;&#45;&#45;%>-->
<!--            <%&#45;&#45;</div>&lt;!&ndash; /.modal &ndash;&gt;&#45;&#45;%>-->
<!--        <%&#45;&#45;</div>&#45;&#45;%>-->
    </div>
    <input id="supplierId" th:value="${#httpServletRequest.getParameter('id')}" style="display: none"/>
    <!-- page specific plugin scripts -->
    <script type="text/javascript" src="/static/statistics/js/jquery.mockjax.js"></script>
    <script type="text/javascript" src="/static/statistics/js/jquery.autocomplete.js"></script>
    <script type="text/javascript" src="/static/ace/components/bootstrap-datepicker/dist/js/bootstrap-datepicker.js"></script>
    <script type="text/javascript" src="/static/ace/components/jqGrid/js/jquery.jqGrid.js"></script>
    <script type="text/javascript" src="/static/ace/components/jqGrid/js/i18n/grid.locale-cn.js"></script>
    <script type="text/javascript" src="/static/layer/layer.js"></script>
    <script type="text/javascript">
    
        var grid_selector = "#grid-table";
        var pager_selector = "#grid-pager";
    
        var grid_prod_selector = "#grid-prod-table";
        var pager_prod_selector = "#grid-prod-pager";
    
        var grid_selector_shop = "#grid-table-shop";
        var pager_selector_shop = "#grid-pager-shop";
    
        var filters = {
            "rules": [{
                "field": "supplierId",
                "data": $("#supplierId").val()
            }]
        };
        var grid_data = {'filters': JSON.stringify(filters)};
        var scripts = [null, "/static/ace/components/bootstrap-datepicker/dist/js/bootstrap-datepicker.js", "/static/ace/components/jqGrid/js/jquery.jqGrid.js", "/static/ace/components/jqGrid/js/i18n/grid.locale-cn.js", "/static/layer/layer.js", null]
    
        $('.page-content-area').ace_ajax('loadScripts', scripts, function () {
            jQuery(function ($) {
                var parent_column = $(grid_selector).closest('[class*="col-"]');
                //resize to fit page size
                $(window).on('resize.jqGrid', function () {
                    $(grid_selector).jqGrid('setGridWidth', parent_column.width());
                })
    
                //resize on sidebar collapse/expand
                $(document).on('settings.ace.jqGrid', function (ev, event_name, collapsed) {
                    if (event_name === 'sidebar_collapsed' || event_name === 'main_container_fixed') {
                        //setTimeout is for webkit only to give time for DOM changes and then redraw!!!
                        setTimeout(function () {
                            $(grid_selector).jqGrid('setGridWidth', parent_column.width());
                        }, 20);
                    }
                })
    
                jQuery(grid_selector).jqGrid({
                    //direction: "rtl",
    
                    //subgrid options
                    subGrid: false,
                    url: "/ktProd/getSupplierProdList",
                    postData: grid_data,
                    datatype: "json",
                    mtype: 'POST',
                    height: 300,
                    colNames: [
                        '自编码','货号','品名','单位','规格',
    // '进货规格6','计价方式7','提成率8','提成金额9',
                        '进货价',
                        '商品价格',
    // '最低限价12','零售价13','批发价14','主供应商15','毛利率16',
                        '助记码',
    //                    '库管类型18',
                        '商品简称',
                        '类别','类别名称',
    //                    '品牌22','品牌名称23','产地24',
                        '供应商编号',
    //                    '经营方式26',
                        '供应商名称',
    //                    '商品属性28','商品类型29','进项税30','销项税31','是否积分32','积分值33','维护库存34','前台赠送35','前台议价36','前台打折37','分店变价38',
                        '建档人','建档时间','最后修改人','最后修改时间'
    //                    ,'英文名称43'
                    ],
    
                    //PageDTO [currentPage=1, pageSize=10, recordList=[{spec=20支, cstPrice=9.1, createTime=2018-05-18 21:13:03, supplierName=默认供应商,
                    // rn=1, imageUrl=null, state=1, brandId=PP, brandName=其他品牌,
                    // productType=1, id=1, stockSpec=1, productTypeName=普通商品, bonusPointsFlag=1,
                    // modifyTime=null, supplierId=1, productCode=6901028000826, shopModifyFlag=1,
                    // rtlPrice=10, supplierPrice=1, unit=包, createUser=null, modifyUser=null,
                    // selfCode=02020034, deliverPrice=0, vipPrice=9, helpCode=JDCXSXYB,
                    // shortName=经典醇香双喜烟包, productName=经典醇香双喜烟包, typeId=3401, dispatchPrice=7, minPrice=0}], recordCount=1, pageCount=1, beginPageIndex=1, endPageIndex=1]
                    colModel: [
                        {name: 'SELF_CODE',index: 'selfCode',editable: true},
                        {name: 'PRODUCT_CODE',index: 'productCode',editable: true},
                        {name: 'BRAND_NAME',index: 'brandName',editable: true},
                        {name: 'UNIT',index: 'unit',editable: true},
                        {name: 'SPEC',index: 'spec',editable: true},
    //                    {name: '6',index: '6',editable: true},
    //                    {name: '7',index: '7',editable: true},
    //                    {name: '8',index: '8',editable: true},
    //                    {name: '9',index: '9',editable: true},
                        {name: 'SUPPLIER_PRICE',index: 'supplierPrice',editable: true},
                        {name: 'CST_PRICE',index: 'cstPrice',editable: true},
    //                    {name: '12',index: 'id',editable: true},
    //                    {name: '13',index: 'id',editable: true},
    //                    {name: '14',index: 'id',editable: true},
    //                    {name: '15',index: 'id',editable: true},
    //                    {name: '16',index: 'id',editable: true},
                        {name: 'HELP_CODE',index: 'helpCode',editable: true},
    //                    {name: '18',index: 'id',editable: true},
                        {name: 'SHORT_NAME',index: 'shortName',editable: true},
                        {name: 'PRODUCT_TYPE',index: 'productType',editable: true},
                        {name: 'PRODUCT_TYPE_NAME',index: 'productTypeName',editable: true},
    //                    {name: '22',index: 'id',editable: true},
    //                    {name: '23',index: 'id',editable: true},
    //                    {name: '24',index: 'id',editable: true},
                        {name: 'SUPPLIER_ID',index: 'supplierId',editable: true, hidden: true},
    //                    {name: '26',index: 'id',editable: true},
                        {name: 'SUPPLIER_NAME',index: 'supplierName',editable: true},
    //                    {name: '28',index: 'id',editable: true},
    //                    {name: '29',index: 'id',editable: true},
    //                    {name: '30',index: 'id',editable: true},
    //                    {name: '31',index: 'id',editable: true},
    //                    {name: '32',index: 'id',editable: true},
    //                    {name: '33',index: 'id',editable: true},
    //                    {name: '34',index: 'id',editable: true},
    //                    {name: '35',index: 'id',editable: true},
    //                    {name: '36',index: 'id',editable: true},
    //                    {name: '37',index: 'id',editable: true},
    //                    {name: '38',index: 'id',editable: true},
                        {name: 'CREATE_USER',index: 'createUser',editable: true},
                        {name: 'create_time',index: 'createTime',editable: true, formatter:"date",formatoptions: {srcformat:'Y-m-d H:i:s',newformat:'Y-m-d H:i:s'}},
                        {name: 'MODIFT_USER',index: 'modiftUser',editable: true},
                        {name: 'modift_time',index: 'modiftTime',editable: true, formatter:"date",formatoptions: {srcformat:'Y-m-d H:i:s',newformat:'Y-m-d H:i:s'}},

                        //                    {name: '43',index: 'id',editable: true},
                    ],
                    rownumbers: true, //自动行数
    //                        width:"1000",
                    autowidth:true,  //宽度自适应
    //                        height:"100%",   //高度自适应
                    viewrecords: true,
                    rowNum : 10,//一页显示多少条
                    rowList : [ 10, 20, 30 ],//可供用户选择一页显示多少条
                    pager : pager_selector,//表格页脚的占位符(一般是div)的id
                    sortname : 'gmtModifiedStr',//初始化的时候排序的字段
                    sortorder : "desc",//排序方式,可选desc,asc
    //                mtype : "post",//向后台请求数据的ajax的类型。可选post,get
                    altRows: true,
    //                toppager: true,
                    multiselect: false,
                    //multikey: "ctrlKey",
                    multiboxonly: true,
    
                    loadComplete: function () {
                        var table = this;
                        setTimeout(function () {
                            styleCheckbox(table);
    
                            updateActionIcons(table);
                            updatePagerIcons(table);
                            enableTooltips(table);
                        }, 0);
                    },
    
                    editurl: "/ktPurchase/saveSupplier",//nothing is saved
                    caption: "商品详细表",
                    jsonReader: {
                        root: "recordList",
                        page: "currentPage",
                        total: "pageCount",
                        records: "recordCount"
                    }
    
                    //,autowidth: true,
    
    
                    /**
                     ,
                     grouping:true,
                     groupingView : {
                     groupField : ['name'],
                     groupDataSorted : true,
                     plusicon : 'fa fa-chevron-down bigger-110',
                     minusicon : 'fa fa-chevron-up bigger-110'
                },
                     caption: "Grouping"
                     */
    
                });
    
                $(window).triggerHandler('resize.jqGrid');//trigger window resize to make the grid get the correct size

                /**
                 * 修改某条信息
                 */
                $("#editShop").click(function () {
                    var id = $(grid_selector).jqGrid('getGridParam', 'selrow');
                    if (!id) {
                        $.jgrid.info_dialog("提示：", "请选择一条信息");
                        return;
                    }
    
                    var rowData = $(grid_selector).jqGrid('getRowData', id);
    //                console.log(rowData);
    //                layer.load(1);
                    getSupplier(rowData);
                    reload();
    
                });
    
                /**
                 * 删除某条数据
                 */
                $("#deleteSupplier").click(function () {
                    var id = $(grid_selector).jqGrid('getGridParam', 'selrow');
                    if (!id) {
                        layer.msg("提示：请选择一条信息");
                        return;
                    }
    //询问框
                    layer.confirm('将会把这条商品数据删除', {
                        btn: ['确定', '取消'] //按钮
                    }, function () {
                        var rowData = $(grid_selector).jqGrid('getRowData', id);
                        queryModel.id = rowData.recordId;
                        queryModel.state = '0';
                        layer.load(1);
                        $.ajax({
                            url: '/ktProd/saveSupplierProd',
                            type: 'post',
                            data: queryModel,
                            dataType: 'json',
                            success: function (data) {
                                layer.closeAll('loading');
                                if (data.success) {
                                    layer.msg('删除成功', {icon: 1});
    
                                } else {
                                    layer.msg(data.message);
                                }
                                reload();
    
                            },
                            error: function (error) {
                                layer.closeAll('loading');
                                $.jgrid.info_dialog("提示：", "服务器异常，稍后再试");
                            }
    
                        })
    
                    }, function () {
                    });
                });
            });
        });
    </script>
    <script type="text/javascript">
    
        /**
         * 搜索店铺
         */
        function search_Shop() {
            var typeId = queryModel.parentId;
            var productCode = $("#productCode").val();
            var productName = $("#productName").val();
            //var parentDepartmentkey = $("#id_parentDepartmentkey_name").val();
    
            var filters = {
                "rules": [
                    {"field": "productCode", "data": productCode},
                    {"field": "productName", "data": productName},
                    {"field": "typeId", "data": typeId}
                ]
            };
            jQuery("#grid-table-shop").jqGrid('setGridParam', {
                postData: {
                    "filters": JSON.stringify(filters) //"{'rules' : [{'field' : 'shopName','data' : "+shopName+"},{'field' : 'state','data' : "+state+"}]}"
                }
            }).trigger("reloadGrid");
        }
    
        /**
         * 搜索店铺
         */
        function searchShop() {
            var keyword = $("#keyword").val();
    //        var phone = $("#phone").val();
            //var parentDepartmentkey = $("#id_parentDepartmentkey_name").val();
    
            var filters = {
                "rules": [{
                    "field": "supplierId",
                    "data": $("#supplierId").val()
                }]
            };
            jQuery("#grid-table").jqGrid('setGridParam', {
                postData: {
                    "filters": JSON.stringify(filters) //"{'rules' : [{'field' : 'shopName','data' : "+shopName+"},{'field' : 'state','data' : "+state+"}]}"
                }
            }).trigger("reloadGrid");
        }
    
        $("#id").show();
        var img64 = "";
        $("#showImageInfoImg").attr("src", img64);
        $("#showImageInfoImg1").attr("src", img64);
    
        var laypage = layui.laypage,
            layer = layui.layer
        laydate = layui.laydate;
    
        var queryModel = {
            //分页参数
            page: '1',
            rows: '10',
            //图片参数
    //        fileStr: '',
    //        fileType: '',
    //        fileStart: '',
    //        supplierName: '',
    //        state: '',
    //        createTime: '',
    //        createUser: '',
    //        modifyTime: '',
    //        modifyUser: '',
    //        contactName: '',
    //        mobile: '',
    //        helpCode: '',
    //        phone: '',
    //        fax: '',
    //        email: '',
    //        zipCode: '',
    //        operatorWay: '',
    //        salesMan: '',
    //        zoneCode: '',
    //        settlementWay: '',
    //        freezeAccounts: '',
    //        freezeBusiness: '',
    //        deliverCycle: '',
    //        settlementCycle: '30',
    //        monthSettlementDay: '30',
    //        remark: '',
    //        registerWay: '',
    //        orgCode: '',
    //        bankOfDeposit: '',
    //        account: '',
    //        businessLicenseNo: '',
    //        taxRegistrationNo: '',
    //        userName: '',
    //        businessLicenseImage: '',
    //        licenseImage: '',
    //        defaultPurchaseWay: '',
    //        guaranteeQuota: '',
    //        discountRate: ''
        }
    
        var app = new Vue({
            el: '#appAlert',
            data: {
                objects: [],
                yanType1: [],
                yanType2: [],
                yanType3: [],
                yanType4: []
            },
            methods: {
                tableShow: function () {
                    $("#alertTitle").html("新增")
                    $("#businessLicenseDiv").addClass("hide")
                    $("#licenceDiv").addClass("hide")
                    $("#tableDiv").removeClass("hide")
                },
                businessLicenseShow: function () {
                    $("#alertTitle").html("营业执照")
                    $("#tableDiv").addClass("hide")
                    $("#licenceDiv").addClass("hide")
                    $("#businessLicenseDiv").removeClass("hide")
                },
                licenceShow: function () {
                    $("#alertTitle").html("许可证")
                    $("#tableDiv").addClass("hide")
                    $("#businessLicenseDiv").addClass("hide")
                    $("#licenceDiv").removeClass("hide")
                },
                saveSupplier: function () {
                    $("#smallTitle").addClass("hide")
                    $("#showImageInfoImg").attr("src",img64)
                    $("#showImageInfoImg1").attr("src",img64)
                    queryObjects()
                },
                addShop: function () {
                    var rowData = {}
                    editShop(rowData)
                },
                submitImg: function () {
    //                submitImg("1")
                },
                submitImg1: function () {
    //                submitImg("2")
                },
                close: function () {
                    $("#alertTitle").html("新增")
                    $("#businessLicenseDiv").addClass("hide")
                    $("#licenceDiv").addClass("hide")
                    $("#tableDiv").removeClass("hide")
                    $("#smallTitle").addClass("hide")
                    $("#showImageInfoImg").attr("src",img64)
                    $("#showImageInfoImg1").attr("src",img64)
                },
                queryShop: function () {
                    queryObjectsShop()
                }
            }
        });
    
        var getSupplier = function (rowData) {
            queryModel.id = rowData.id;
            layer.load(1)
            $.ajax({
                url: '/ktPurchase/getSupplier',
                type: 'post',
                data: queryModel,
                success: function (data) {
                    layer.closeAll('loading');
                    if (data.success == false){
                        layer.msg("获取出错："+data.message)
                        return
                    }
                    var dataArray = data.data;
                    if (dataArray.length == 0){
                        layer.msg("查询没有数据")
                        return
                    }
                    console.log(dataArray)
                    editShop(dataArray);
                },
                error: function (error) {
                    layer.closeAll('loading')
                }
            })
        };
    
        var queryModel_map = {
            //分页参数
            page: '1',
            rows: '10',
    
            parentId: '0'  //商品4级下拉菜单
        }
    
        var getObjectsShop = function (queryModel_map) {
            layer.load(1)
            $.ajax({
                url: '/ktProd/getProdInfo',
                type: 'post',
                data: queryModel_map,
                success: function (data) {
                    layer.closeAll('loading');
                    if (data.success == false){
                        layer.msg("获取出错："+data.message)
                        return
                    }
                    var dataArray = data.recordList;
                    if (dataArray.length == 0){
                        layer.msg("查询没有数据")
                        return
                    }
                    app.objects = dataArray;
                },
                error: function (error) {
                    layer.closeAll('loading')
                }
            })
        };
    
        var queryObjectsShop = function () {
            var typeId = queryModel_map.parentId;
            var productCode = $("#productCode").val();
            var productName = $("#productName").val();
    
            if (typeId == "0"){
                typeId = "";
            }
            console.log(typeId);
            var filters = {
                "rules": [
                    {"field": "productCode", "data": productCode},
                    {"field": "productName", "data": productName},
                    {"field": "typeId", "data": typeId}
                ]
            };
            queryModel_map.filters = JSON.stringify(filters);
            console.log(queryModel_map);
            getObjectsShop(queryModel_map)
        }
        queryObjectsShop()
    
        $('#beginTime').datetimepicker({
            language: 'zh-CN',
            weekStart: 1,
            todayBtn: 1,
            autoclose: 1,
            todayHighlight: 1,
            startView: 2,
            forceParse: 0,
            minView: 2,
            showMeridian: 1,
            format: "yyyy-mm-dd",
    //        startDate:new Date(),
        });
    
        $('#endTime').datetimepicker({
            language: 'zh-CN',
            weekStart: 1,
            todayBtn: 1,
            autoclose: 1,
            todayHighlight: 1,
            startView: 2,
            forceParse: 0,
            minView: 2,
            showMeridian: 1,
            format: "yyyy-mm-dd",
    //        startDate:new Date(),
        });
    
        /**
         * 弹窗内容
         * @param rowData
         */
        var editShop = function (rowData) {
            $("#id").val(rowData.id);
            $("#supplierName").val(rowData.supplierName);
            $("#state").val(rowData.state);
            $("#createTime").val(rowData.createTime);
            $("#createUser").val(rowData.createUser);
            $("#modifyTime").val(rowData.modifyTime);
            $("#modifyUser").val(rowData.modifyUser);
            $("#contactName").val(rowData.contactName);
            $("#mobile").val(rowData.mobile);
            $("#helpCode").val(rowData.helpCode);
            $("#phone").val(rowData.phone);
            $("#fax").val(rowData.fax);
            $("#email").val(rowData.email);
            $("#zipCode").val(rowData.zipCode);
            $("#operatorWay").val(rowData.operatorWay);
            $("#salesMan").val(rowData.salesMan);
            $("#zoneCode").val(rowData.zoneCode);
            $("#settlementWay").val(rowData.settlementWay);
            $("#freezeAccounts").val(rowData.freezeAccounts);
            $("#freezeBusiness").val(rowData.freezeBusiness);
            $("#deliverCycle").val(rowData.deliverCycle);
    //        $("#settlementCycle").val(rowData.settlementCycle);
    //        $("#monthSettlementDay").val(rowData.monthSettlementDay);
            $("#remark").val(rowData.remark);
            $("#registerWay").val(rowData.registerWay);
            $("#orgCode").val(rowData.orgCode);
            $("#bankOfDeposit").val(rowData.bankOfDeposit);
            $("#account").val(rowData.account);
            $("#businessLicenseNo").val(rowData.businessLicenseNo);
            $("#taxRegistrationNo").val(rowData.taxRegistrationNo);
            $("#userName").val(rowData.userName);
    //        $("#businessLicenseImage").val(rowData.businessLicenseImage);
    //        $("#licenseImage").val(rowData.licenseImage);
            $("#defaultPurchaseWay").val(rowData.defaultPurchaseWay);
            $("#guaranteeQuota").val(rowData.guaranteeQuota);
            $("#discountRate").val(rowData.discountRate);
    
            var businessLicenseImage = !rowData.businessLicenseImage;
            var licenseImage = !rowData.licenseImage;
            console.log(!licenseImage)
            if (!businessLicenseImage) {
                $("#showImageInfoImg").attr("src", 'http://clouderp.skystorechain.com:20081/'+rowData.businessLicenseImage);
            }
            if (!licenseImage) {
                $("#showImageInfoImg1").attr("src", 'http://clouderp.skystorechain.com:20081/'+rowData.licenseImage);
            }
            $('#myModal').modal('show');
        }
    
    
        var reload = function () {
    //        $(grid_selector).jqGrid('clearGridData');  //清空表格
            $(grid_selector).jqGrid('setGridParam',{
                url:"/ktProd/getSupplierProdList",
                datatype:'json',
                postData: grid_data,
                page:1
            }).trigger("reloadGrid"); //重新载入
        }
    
    </script>
    <script type="application/javascript">
        //it causes some flicker when reloading or navigating grid
        //it may be possible to have some custom formatter to do this as the grid is being created to prevent this
        //or go back to default browser checkbox styles for the grid
        function styleCheckbox(table) {
            /**
             $(table).find('input:checkbox').addClass('ace')
             .wrap('<label />')
             .after('<span class="lbl align-top" />')
    
    
             $('.ui-jqgrid-labels th[id*="_cb"]:first-child')
             .find('input.cbox[type=checkbox]').addClass('ace')
             .wrap('<label />').after('<span class="lbl align-top" />');
             */
        }
    
    
        //unlike navButtons icons, action icons in rows seem to be hard-coded
        //you can change them like this in here if you want
        function updateActionIcons(table) {
            /**
             var replacement =
             {
                 'ui-ace-icon fa fa-pencil' : 'ace-icon fa fa-pencil blue',
                 'ui-ace-icon fa fa-trash-o' : 'ace-icon fa fa-trash-o red',
                 'ui-icon-disk' : 'ace-icon fa fa-check green',
                 'ui-icon-cancel' : 'ace-icon fa fa-times red'
             };
             $(table).find('.ui-pg-div span.ui-icon').each(function(){
                    var icon = $(this);
                    var $class = $.trim(icon.attr('class').replace('ui-icon', ''));
                    if($class in replacement) icon.attr('class', 'ui-icon '+replacement[$class]);
                })
             */
        }
    
        //replace icons with FontAwesome icons like above
        function updatePagerIcons(table) {
            var replacement =
                {
                    'ui-icon-seek-first': 'ace-icon fa fa-angle-double-left bigger-140',
                    'ui-icon-seek-prev': 'ace-icon fa fa-angle-left bigger-140',
                    'ui-icon-seek-next': 'ace-icon fa fa-angle-right bigger-140',
                    'ui-icon-seek-end': 'ace-icon fa fa-angle-double-right bigger-140'
                };
            $('.ui-pg-table:not(.navtable) > tbody > tr > .ui-pg-button > .ui-icon').each(function () {
                var icon = $(this);
                var $class = $.trim(icon.attr('class').replace('ui-icon', ''));
    
                if ($class in replacement) icon.attr('class', 'ui-icon ' + replacement[$class]);
            })
        }
    
        function enableTooltips(table) {
            $('.navtable .ui-pg-button').tooltip({container: 'body'});
            $(table).find('.ui-pg-div').tooltip({container: 'body'});
        }
    </script>
    
    <script type="text/javascript">
        var addSupplier = function () {
            console.log(queryModel_map);
            layer.load(1)
            $.ajax({
                url: '/ktProd/saveSupplierProd',
                type: 'post',
                data: queryModel_map,
                success: function (data) {
                    layer.closeAll('loading');
                    if (data.success == false){
                        layer.msg("提示："+data.message)
                        return
                    }
                    if (data.success){
                        layer.msg("提示："+data.message)
                    }
                    reload()
                },
                error: function (error) {
                    layer.closeAll('loading')
                }
            })
        }
    
        //    $("#supplierPrice").blur(function () {
        //        var supplierPrice = this.value;
        //        alert(supplierPrice);
        //        layer.msg("提示：")
        //        $("#supplierPrice").val("");
        //    })
    
        var addSupplierShop = function () {
            var ids = $(grid_prod_selector).jqGrid('getGridParam', 'selarrrow');
            if(!ids){
                layer.msg("提示：请选择商品")
                return
            }

            /*<![CDATA[*/
            for(var i = 0; i < ids.length; i++){
            /*]]>*/
                var rowData = $(grid_prod_selector).jqGrid('getRowData', ids[i]);
                var cstPrice_Id = "#cstPrice_" + rowData.productCode;;
                var supplierPrice = $(cstPrice_Id).val();
                if (supplierPrice == ""){
                    layer.msg("提示：供货价不能为空！")
                    return
                }
    
    
                var productCode = rowData.productCode;
                var cstPrice = rowData.cstPrice

                queryModel_map.productCode = rowData.productCode;;
                queryModel_map.cstPrice = $(cstPrice_Id).val();
                queryModel_map.state = '1';
                queryModel_map.supplierId = $("#supplierId").val();
    //        queryModel_map.filters = JSON.stringify(filters);
                addSupplier(queryModel_map)
    
            }

        }
    
        /**
         * 下啦联动数据绑定 开始代码
         * @type {{parentId: string}}
         */
        $('#isExpInput').change(function () {
            app.yanType2 = []
            app.yanType3 = []
            app.yanType4 = []
            queryModel_map.parentId = $("#isExpInput option:selected").val();
    
            console.log(queryModel_map)
            querySubProdType2()
        });
    
        $('#isAuthInput').change(function () {
            app.yanType3 = []
            app.yanType4 = []
            queryModel_map.parentId = $("#isAuthInput option:selected").val();
            querySubProdType3()
        });
    
        $('#isAuthInput1').change(function () {
            app.yanType4 = []
            queryModel_map.parentId = $("#isAuthInput1 option:selected").val();
            querySubProdType4()
        });
    
        var querySubProdType1 = function () {
            getSubProdType1(queryModel_map)
        }
        var querySubProdType2 = function () {
            getSubProdType2(queryModel_map)
        }
        var querySubProdType3 = function () {
            getSubProdType3(queryModel_map)
        }
        var querySubProdType4 = function () {
            getSubProdType4(queryModel_map)
        }
    
    
        var getSubProdType1 = function (queryModel_map) {
            $.ajax({
                url: '/ktProd/getSubProdType',
                type: 'post',
                data: queryModel_map,
                success: function (data) {
                    if (data.success == false){
                        layer.msg("获取出错："+data.message)
                        return
                    }
                    var dataArray = data;
                    if (dataArray.length == 0){
                        layer.msg("查询没有数据")
                        return
                    }
                    app.yanType1 = dataArray;
    
                },
                error: function (error) {
                }
            })
        }
    
        var getSubProdType2 = function (queryModel_map) {
            console.log(queryModel_map)
            $.ajax({
                url: '/ktProd/getSubProdType',
                type: 'post',
                data: queryModel_map,
                success: function (data) {
                    if (data.success == false){
                        layer.msg("获取出错："+data.message)
                        return
                    }
                    var dataArray = data;
                    if (dataArray.length == 0){
                        layer.msg("查询没有数据")
                        return
                    }
                    console.log("dataArray: "+dataArray)
                    app.yanType2 = dataArray;
                },
                error: function (error) {
                }
            })
        }
    
        var getSubProdType3 = function (queryModel_map) {
            console.log(queryModel_map)
            $.ajax({
                url: '/ktProd/getSubProdType',
                type: 'post',
                data: queryModel_map,
                success: function (data) {
                    if (data.success == false){
                        layer.msg("获取出错："+data.message)
                        return
                    }
                    var dataArray = data;
                    if (dataArray.length == 0){
                        layer.msg("查询没有数据")
                        return
                    }
                    app.yanType3 = dataArray;
    
                },
                error: function (error) {
                }
            })
        }
    
        var getSubProdType4 = function (queryModel_map) {
            $.ajax({
                url: '/ktProd/getSubProdType',
                type: 'post',
                data: queryModel_map,
                success: function (data) {
                    if (data.success == false){
                        layer.msg("获取出错："+data.message)
                        return
                    }
                    var dataArray = data;
                    if (dataArray.length == 0){
                        layer.msg("查询没有数据")
                        return
                    }
                    app.yanType4 = dataArray;
    
                },
                error: function (error) {
                }
            })
        }
        getSubProdType1(queryModel_map);
        /**
         * 下啦联动数据绑定 结束代码
         */
    </script>
    <script>
    
        $(document).ready(function() {
    
    
    
    //        $("#supplierPrice").blur(function () {
    //            alert(1234567890)
    ////            var supplierPrice = $("#supplierPrice").val();
    ////            alert(supplierPrice);
    ////            layer.msg("提示：")
    ////            $("#supplierPrice").val("");
    //        })
    
            //正浮点数
            var realmin = function (str) {
                var pattern = /[1-9]\d*.\d*|0.\d*[1-9]\d*/;
                console.log(pattern.test(str));
                return pattern.test(str);
            }
        });
    
    </script>
    <!-- 商品列表详情 -->
    <script>
    
        $("#addProduct").click(function () {
            prodInfo1('', grid_prod_selector, pager_prod_selector);
            $('#myModal').modal('show');
        })
    
        /**
         * jqGrid 商品数据列表加载方法
         */
        var prodInfo1 = function(contextPath ,grid_prod_selector, pager_prod_selector) {
            jQuery(grid_prod_selector).jqGrid({
                subGrid: false,
                url : '/ktProd/getProdInfo',
                datatype: "json",
                mtype: 'POST',
                height: 300,
                colNames: ['ID', '商品名称', 'supplierId', '供应名称', '类型', '条码','单价','状态','单位','规格', '操作时间'],
                colModel: [
                    {name: 'id', index: 'id', editable: true, hidden: true,},
                    {
                        name: 'productName',
                        index: 'productName',
    //                    width: 90,
                        editable: true,
                        sortable: false,
                        editrules: {required: true}
                    },
                    {name: 'supplierId', index: 'productId', editable: true, hidden: true,},
                    {
                        name: 'supplierName', index: 'productId',
    //                    width: 78,
                        editable: true,
                        edittype: 'select', hidden: true,
                    },
                    {
                        name: 'prodTypeName',
                        index: 'prodTypeName',
    //                    width: 60,
                        editable: true,
                        sortable: false,
                        editrules: {required: true}
                    },
                    {
                        name: 'productCode',
                        index: 'productCode',
    //                    width: 60,
                        editable: true,
                        sortable: false,
                        editrules: {required: true}
                    },
                    {
                        name: 'cstPrice',
                        index: 'cstPrice',
    //                    width: 60,
                        editable: true,
                        sortable: false,
    //                    hidden: true,
                        editrules: {required: true},
                        formatter:function(cellvalue, options, rowObject) {
                            var productCode = rowObject.productCode;
                            var cstPrice = rowObject.cstPrice;
                            if(!cstPrice){
                                cstPrice = "0"
                            }
                            return ' <input type="text" id="cstPrice_'+productCode+'" value="'+cstPrice+'" style="background-color: #ffffff;border:0;outline:0; margin-top: -16px;float: right; text-align: right;" />';
                        }
                    },
                    {
                        name: 'state',
                        index: 'state',
    //                    width: 40,
                        editable: true,
                        hidden: true,
                        sortable: false,
                        edittype: 'select',
                        formatter: function (v, x, r) {
                            return r['state'] == "1" ? "有效" : "无效";
                        },
                        editoptions: {value: "0:有效;1:无效"}
    
                    },
                    {
                        name: 'unit',
                        index: 'unit',
    //                    width: 30,
                        editable: true,
                        sortable: false
                    },{
                        name: 'spec',
                        index: 'spec',
    //                    width: 60,
                        editable: true,
                        hidden: true,
                        sortable: false
                    },
                    {
                        name: 'stateDate', index: 'stateDate',
    //                    width: 60,
                        editable: false, hidden: true,
                    }
    
                ],
    //                rownumbers: true, //自动行数
                height:"100%",   //高度自适应
    //			width: "100%",
                autowidth: true,  //宽度自适应
                viewrecords: true,
                rowNum: 10,
                rowList: [10, 20, 30],
                pager: pager_prod_selector,
                altRows: true,
                //toppager: true,
    
                multiselect: true,
                //multikey: "ctrlKey",
                multiboxonly: true,
    
                loadComplete: function () {
                    var table = this;
                    setTimeout(function () {
                        styleCheckbox(table);
    
                        updateActionIcons(table);
                        updatePagerIcons(table);
                        enableTooltips(table);
                    }, 0);
                },
    
                editurl: '/ktProd/getProdInfo',//nothing is saved
    //            caption: "商品列表",
                jsonReader: {
                    root: "recordList",
                    page: "currentPage",
                    total: "pageCount",
                    records: "recordCount"
                },
    //                onSelectAll: function(rowids,statue){
    //                    //函数里做自己的处理
    //					queryModel.rowIds = rowids;
    //                },
    //                resetSelection: function(rowid){
    //
    //                    return(rowid)
    //				}
    
                //,autowidth: true,
    
    
                /**
                 ,
                 grouping:true,
                 groupingView : {
                     groupField : ['name'],
                     groupDataSorted : true,
                     plusicon : 'fa fa-chevron-down bigger-110',
                     minusicon : 'fa fa-chevron-up bigger-110'
                },
                 caption: "Grouping"
                 */
    
            });
    
        }
    
    
    
        /**
         * 搜索商品
         */
        function searchShopProduct() {
            var supplierName = $("#supplierName").val();
            var productCode = $("#productCode").val();
    //        var state = $("#state1").val();
            var productName = $("#productName").val();
            var typeId = queryModel.parentId == null ? "0" : queryModel.parentId;
            //var parentDepartmentkey = $("#id_parentDepartmentkey_name").val();
    
            var filters = {
                "rules": [
                    {"field": "productCode", "data": productCode},
                    {"field": "productName", "data": productName},
    //                {"field": "supplierName", "data": supplierName},
                    {"field": "typeId", "data": typeId},
                    {"field": "state", "data": '1'}
                ]
            };
            console.log(JSON.stringify(filters))
            jQuery(grid_prod_selector).jqGrid('setGridParam', {
                postData: {
                    "filters": JSON.stringify(filters) //"{'rules' : [{'field' : 'shopName','data' : "+shopName+"},{'field' : 'state','data' : "+state+"}]}"
                }
            }).trigger("reloadGrid");
        }
    </script>
</body>
</html>